Optimal. Leaf size=63 \[ \frac {B x}{b}-\frac {2 B \sqrt {a-b} \sqrt {a+b} \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a b d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.09, antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.107, Rules used = {2735, 2659, 205} \[ \frac {B x}{b}-\frac {2 B \sqrt {a-b} \sqrt {a+b} \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 205
Rule 2659
Rule 2735
Rubi steps
\begin {align*} \int \frac {\frac {b B}{a}+B \cos (c+d x)}{a+b \cos (c+d x)} \, dx &=\frac {B x}{b}-\frac {\left (a B-\frac {b^2 B}{a}\right ) \int \frac {1}{a+b \cos (c+d x)} \, dx}{b}\\ &=\frac {B x}{b}-\frac {\left (2 \left (a-\frac {b^2}{a}\right ) B\right ) \operatorname {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b d}\\ &=\frac {B x}{b}-\frac {2 \sqrt {a-b} \sqrt {a+b} B \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.13, size = 64, normalized size = 1.02 \[ \frac {B \left (2 \sqrt {b^2-a^2} \tanh ^{-1}\left (\frac {(b-a) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {b^2-a^2}}\right )+a (c+d x)\right )}{a b d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 3.91, size = 194, normalized size = 3.08 \[ \left [\frac {2 \, B a d x + \sqrt {-a^{2} + b^{2}} B \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right )}{2 \, a b d}, \frac {B a d x - \sqrt {a^{2} - b^{2}} B \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right )}{a b d}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.74, size = 281, normalized size = 4.46 \[ -\frac {\frac {{\left (\sqrt {a^{2} - b^{2}} B {\left | a - b \right |} {\left | a \right |} {\left | b \right |} + {\left (2 \, a^{2} + a b\right )} \sqrt {a^{2} - b^{2}} B {\left | a - b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {a^{2} + \sqrt {a^{4} - {\left (a^{2} + a b\right )} {\left (a^{2} - a b\right )}}}{a^{2} - a b}}}\right )\right )}}{{\left (a - b\right )} a^{2} b^{2} + {\left (a^{3} - a^{2} b\right )} {\left | a \right |} {\left | b \right |}} + \frac {{\left (2 \, B a^{3} - B a^{2} b - B a b^{2} - B a {\left | a \right |} {\left | b \right |} + B b {\left | a \right |} {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {a^{2} - \sqrt {a^{4} - {\left (a^{2} + a b\right )} {\left (a^{2} - a b\right )}}}{a^{2} - a b}}}\right )\right )}}{a^{2} b^{2} - a^{2} {\left | a \right |} {\left | b \right |}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.09, size = 117, normalized size = 1.86 \[ -\frac {2 B a \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d b \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 B b \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d a \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 B \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.94, size = 93, normalized size = 1.48 \[ \frac {2\,B\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d}+\frac {2\,B\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a+b\right )}\right )\,\sqrt {b^2-a^2}}{a\,b\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 32.92, size = 235, normalized size = 3.73 \[ \begin {cases} \text {NaN} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x \left (B \cos {\relax (c )} + \frac {B b}{a}\right )}{a + b \cos {\relax (c )}} & \text {for}\: d = 0 \\\frac {B x}{b} & \text {for}\: a = b \\\frac {B \sin {\left (c + d x \right )}}{a d} & \text {for}\: b = 0 \\\frac {B x}{b} & \text {for}\: a = - b \\\frac {B x}{b} - \frac {B \log {\left (- \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )}}{b d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} + \frac {B \log {\left (\sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )}}{b d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} - \frac {B \log {\left (- \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )}}{a d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} + \frac {B \log {\left (\sqrt {- \frac {a}{a - b} - \frac {b}{a - b}} + \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )} \right )}}{a d \sqrt {- \frac {a}{a - b} - \frac {b}{a - b}}} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________